package router

import (
	"litetalk/api/handler"

	"github.com/gin-gonic/gin"
)

func Register() *gin.Engine {
	r := gin.Default()
	r.Use(handler.CoreMiddleware)
	initUserRouter(r)
	return r
}

var api = handler.ApiHandler{}

func initUserRouter(r *gin.Engine) {
	userGroup := r.Group("/user")
	userGroup.POST("/login", handler.Login)
	userGroup.POST("/register", handler.Register)
	userGroup.POST("/logout", handler.Logout)

	api.Group(r)
}

type FormCheckSessionId struct {
	AuthToken string `form:"authToken" json:"authToken" binding:"required"`
}
